<?php

include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/inc/session_check.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/DAL/DAL.danciOperator.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/DAL/DAL.ReportWrongWord.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/Model/Model.ReportWrongWord.php");
include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/class.ReportWrongWord.php");
$r = new ReportWrongWord();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {//for ajax
//print_r($_POST["data"]);
    date_default_timezone_set('PRC');
    $ReportWongWord = new Model_ReportWrongWord();
    $ReportWongWord->meaning = trim($_POST["meaning"]);
    $ReportWongWord->read = trim($_POST["read"]);
    $ReportWongWord->remark = trim($_POST["remark"]);
    $ReportWongWord->reportdate = date('Y-m-d H:i:s');
    $ReportWongWord->reportuserid = $_SESSION['userid'];
    $ReportWongWord->reportusername = $_SESSION['username'];
    $ReportWongWord->species = trim($_POST["species"]);
    $ReportWongWord->word = trim($_POST["word"]);
    $ReportWongWord->wordid = trim($_POST["wordid"]);
    try {

        $r->SaveReportWrongWord($ReportWongWord);
        $arr["returnval"] = 1;
    } catch (Exception $e) {
        $arr["returnval"] = -1;
    }
    header('Content-type: application/json');
    echo json_encode($arr); //输出json数据 
} else {
    $wid = Common::is_empty($_GET["wid"], 0);
    $r->display($wid);
}


